Julien698
Julien698

Reputation: 716

It is possible to use <0></0> in xml?

I'm trying to build an XML file (which will be converted to JSON later on).

Therefore I must respect a schema, and i need to put <0> and <1> in the XML but it doesn't work. I also try to put <\0> and <\1> but it says that it's not a good char for XML.

<Result>
    <Content>
        <0></0>
        <1></1>
    </Content>
</Result>

In the debugger in Visual Studio I put a break point in the aim to see the xml, but with <0> i can't open the document as a XML, only as Text.

How can I fix that?

Upvotes: 4

Views: 508

Answers (2)

Mathew Thompson
Mathew Thompson

Reputation: 56429

It's possible, but you have to use the CDATA tag, but that means that they're not actually XML elements though. This technique is used when putting HTML in an XML file.

<Result>
    <Content>
        <![CDATA[
            <0>
           </0>
           <1>
          </1>
       ]]>
    </Content>
</Result>

Upvotes: 2

zmbq
zmbq

Reputation: 39013

It is impossible. XML element names must start with a letter or underscore .

Upvotes: 8

Related Questions