nikgoodley-ibboost / aost

Automatically exported from code.google.com/p/aost
0 stars 0 forks source link

Source not well-formed error when build xml for UI objects #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the customize tab, we build xml and from the xml to generate the UI
objects. But we have the error:

Error: not well-formed
Source File: chrome://trump/content/trump-ide.xul
Line: 13, Column: 135
Source Code:
   <UiObject desc="UrlLink(uid: 'a8', clocator: [tag: 'a', text: 'Request
Code Review', href: '/p/aost/issues/entry?show=review&former=sourcelist'])"/>

The built UI module is

Container(uid: "root", clocator: [tag: "body", class: "t4"]){
    Container(uid: "T4ttt", clocator: [tag: "table", id: "mt"]){
        UrlLink(uid: "a1", clocator: [tag: "a", text: "Issues", href:
"/p/aost/issues/list"], respond: ["click"])
        UrlLink(uid: "a2", clocator: [tag: "a", text: "Wiki", href:
"/p/aost/w/list"], respond: ["click"])
        UrlLink(uid: "a3", clocator: [tag: "a", text: "Downloads", href:
"/p/aost/downloads/list"], respond: ["click"])
        UrlLink(uid: "a4", clocator: [tag: "a", text: "Source", href:
"/p/aost/source/checkout"], respond: ["click"])
    }
    Form(uid: "T4ttttddf", clocator: [tag: "form", method: "get", action:
"http://www.google.com/codesearch"]){
        InputBox(uid: "input0", clocator: [tag: "input", title: "Google Code
Search", name: "origq", id: "origq"])
        SubmitButton(uid: "input5", clocator: [tag: "input", type: "submit",
name: "btnG", value: "Search Trunk"])
        UrlLink(uid: "a8", clocator: [tag: "a", text: "Request Code Review",
href: "/p/aost/issues/entry?show=review&former=sourcelist"])
    }
    Form(uid: "T4ttttf", clocator: [tag: "form", action: "/hosting/search"]){
        InputBox(uid: "input6", clocator: [tag: "input", name: "q"])
        SubmitButton(uid: "input7", clocator: [tag: "input", type: "submit",
value: "Search Projects", name: "projectsearch"])
    }
}

If remove element a8, seems no error. 

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 13 Feb 2009 at 3:40

GoogleCodeExporter commented 9 years ago
This may be caused by the fact that for XML, special characters such as '&'
should be encoded or escaped.

Read the following post

---------------------------------------------------------------

Characters like "<" and "&" are illegal in XML elements.

"<" will generate an error because the parser interprets it as the start of a 
new
element.

"&" will generate an error because the parser interprets it as the start of an
character entity. 

Some text, like JavaScript code, contains a lot of "<" or "&" characters. To 
avoid
errors script code can be defined as CDATA.

Everything inside a CDATA section is ignored by the parser.

A CDATA section starts with "<![CDATA[" and ends with "]]>"

Original comment by John.Jian.Fang@gmail.com on 13 Feb 2009 at 3:03

GoogleCodeExporter commented 9 years ago
An ampersand (&) may be escaped numerically (&) or with a general
entity
(&).

<SUPPLIERCOMPANYNAME>JONSON & JONSON</SUPPLIERCOMPANYNAME>

Original comment by John.Jian.Fang@gmail.com on 13 Feb 2009 at 3:11

GoogleCodeExporter commented 9 years ago
ublic string XMLEncode(string Value)
{
     return Value.Replace ("&", "&").Replace("'", "'").Replace ("\"",
""").Replace ("<", "<").Replace(">", ">");
} 

public string XMLDecode(string Value)
{
    return Value.Replace ("&", "&").Replace("'", "'").Replace ("<",
"<").Replace (">", ">");
}

Original comment by John.Jian.Fang@gmail.com on 13 Feb 2009 at 3:16

GoogleCodeExporter commented 9 years ago
Seems fixed the problem if we using replacement for the special characters, but 
need
to remember to replace it back with do saving.

Original comment by John.Jian.Fang@gmail.com on 13 Feb 2009 at 9:19