Find empty elements
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 2
- Joined: Sat Jun 09, 2007 6:41 pm
- Location: Atlanta, Ga.
Find empty elements
Does Oxygen have any tools that would help me find empty elements (and possibly remove them all) in a large document?
The application that created this document makes lots of empty elements for fields in which someone doesn't enter data.
(Newby here)
The application that created this document makes lots of empty elements for fields in which someone doesn't enter data.
(Newby here)
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
You can remove the empty elements by executing a Find/Replace with the following regexp as the find expression: <([^</>"=]+?)>(\s*?)</(.+?)> and the empty string as the replace expression. This works for elements in the form:
and
For elements of the form:
you should use the find expression: <([^</>"=]+?)/>
Regards,
Sorin
You can remove the empty elements by executing a Find/Replace with the following regexp as the find expression: <([^</>"=]+?)>(\s*?)</(.+?)> and the empty string as the replace expression. This works for elements in the form:
Code: Select all
<elem1> </elem1>
Code: Select all
<elem2>
</elem2>
Code: Select all
<elem3 />
Regards,
Sorin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service