Solved

Need help with storing RegEx in XML

Posted on 2007-04-01
2
237 Views
Last Modified: 2012-05-05
Hi,
 I need to store some regular expressions in an XML but the special characters appear to be causing problems. I read somewhere that if I convert them to hex it works ok but I'd prefer to store them as they are. Does anyone know how I can get around this?

<RegularExpressions>
      <TEST>
            <Node><(?<tag>TEST)>(?<text>.*)</\k<tag>></Node>
            <Node><(?<tag>TESTA)>(?<text>.*)</\k<tag>></Node>
      </TEST>
</RegularExpressions>

        'load the xml file
        xd.Load(Application.StartupPath & "\RegularExpressions.xml")
        Dim Node As XmlNode
        Dim ChildNode As XmlNode

        Node = xd.SelectSingleNode("//TEST")
        For Each ChildNode In Node
            MsgBox(ChildNode.InnerXml)
        Next
0
Comment
Question by:e_murf1
2 Comments
 
LVL 10

Accepted Solution

by:
MrClyfar earned 500 total points
ID: 18833223
Hi there.

Try storing the actual XML node data in a CData attrbiute eg

<xmlElement>
    <![CDATA[Test <> (? expression ) >&""""!!!]]>
</xmlElement>

CData is useful in situation where you will be storing data in XML format that might cause problems for an XML parser.

Jas.
0
 

Author Comment

by:e_murf1
ID: 18834670
That worked perfectly. Thanks for the help.
Eoghan.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now