"Regular Expression to Match Output" not working f

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

"Regular Expression to Match Output" not working f

Post by PeterB »

I want to use the XML parser "xmlwf" from James Clark. It works for me, but, the match output isn't working for me. When I click to the left of a problem line in my text output window, it just beeps at me. It doesn't take me to the line in the file. I've tried all of the examples in the TextPad documentation.

Thanks,
Peter
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

In order for anyone to be able to help you, you need to provide some samples of typical error output from this application.
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

Regular Expression to match output not working.

Post by PeterB »

These two lines are what I get when I parse an XML file that I've purposely removed a portion of a closing element.


I:\DTR\XML>c:\sgml\xml\expat\bin\xmlwf.exe I:\DTR\XML\dtr80424.xml
I:\DTR\XML\dtr80424.xml:11:2: mismatched tag

The "mismatched tag" is shown, obviously. But, when I click on that line, it doesn't take me into the original file where the error is. That's what I want it to do.

Thanks.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Where is the error? Is it on line 11 at column 2?
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

Post by PeterB »

Yes, It's here, line 11 of the original file. It's not character 2, but, line 11 is close enough. I want it to go to the offending line.

line 11 </publication.>
There should be the word "date" after the period in "publication."
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Select Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Then try
Regular expression to match output: ^(..[^:]*):([0-9]+):([0-9]+):

Registers:
File: 1
Line: 2
Column: 3
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

Regular Expression Finds

Post by PeterB »

Thanks, Ben.
Sorry. I never got an e-mail that you'd responded here again. Yes, I always have POSIX turned on. Your regex works for me. Meaning, it does take me into the file where the "error" is. Now, it takes me to the wrong line entirely, though. For testing, I simply took out a close tag for a heading at the top of a file. When I parsed it and went to the error, it took me hundreds of lines down, to where the <document> ends at </document>. Is this normal?

Thanks a lot,
Peter
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

No. it's not normal. What exactly was the error message line you clicked on, and what line number did it take you to?
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

Post by PeterB »

Here's my output:
I:\DTR\XML>c:\sgml\xml\expat\bin\xmlwf.exe I:\DTR\XML\dtr80417.xml
I:\DTR\XML\dtr80417.xml:325:2: mismatched tag

For testing, I took out the end tag for a head. I removed a </head> on line 15. As you can see above, it recognizes an error, but, it takes me to line 325! Now, I'm not that familiar with this particular xml parser. I've just read on its web site that it's not a "validating" parser. Which might explain its uselesness here. I'm trying to find out from some of my colleagues if they know of any other good "validating" xml parsers for Windows command line use.

-Peter
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

That's a problem with your parser. TextPad is behaving correctly.
PeterB
Posts: 10
Joined: Thu Jul 08, 2004 4:35 pm
Location: Washington, DC
Contact:

Post by PeterB »

Yes, you're probably right. I'm looking into it. Thanks for your help.
Post Reply